//
//  HeadCollectionReusableView.m
//  WZYInteriorDesign
//
//  Created by lanou on 15/12/18.
//  Copyright (c) 2015年 lanou. All rights reserved.
//

#import "HeadCollectionReusableView.h"
#import "UIImageView+AFNetworking.h"
#import "MainDetailModel.h"
@implementation HeadCollectionReusableView

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        //覆盖视图
        _coverImage = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 375, 250)];
        _coverImage.backgroundColor = [UIColor redColor];
        [self addSubview:_coverImage];
        //人物图片
        _personImage = [[UIImageView alloc]initWithFrame:CGRectMake(135, 30, 80,80)];
        _personImage.backgroundColor = [UIColor grayColor];
        [self setImageViewWithLayer:_personImage];
        [self addSubview:_personImage];
        //大标题
        _bigLabel = [[UILabel alloc]initWithFrame:CGRectMake(135, 130, 180, 40)];
        [self setBigLabel:_bigLabel];
        [self addSubview:_bigLabel];
        //小标题
        _smallLabel = [[UILabel alloc]initWithFrame:CGRectMake(80, 160, 180, 40)];
        [self setSmallLabel:_smallLabel];
        [self addSubview:_smallLabel];
    }
    return self;
}
//将人物图设置为圆形
- (void)setImageViewWithLayer:(UIImageView *)imageView{
    imageView.layer.cornerRadius = imageView.bounds.size.height/2;
    imageView.layer.borderWidth = 2;
    imageView.layer.masksToBounds = YES;
    imageView.layer.borderColor = [[UIColor redColor]CGColor];
}

//封装字体 大标题
- (void)setBigLabel:(UILabel *)bigLabel{
    bigLabel.font = [UIFont systemFontOfSize:18];
    bigLabel.numberOfLines = 0;
    bigLabel.textColor = [UIColor cyanColor];
}

//封装字体 小标题
- (void)setSmallLabel:(UILabel *)bigLabel{
    bigLabel.font = [UIFont systemFontOfSize:12];
    bigLabel.numberOfLines = 0;
    bigLabel.textColor = [UIColor whiteColor];
}

//重写set方法
- (void)setMainDetail:(MainDetailModel *)mainDetail{
    if (_mainDetail != mainDetail) {
        _mainDetail = mainDetail;
        [_coverImage setImageWithURL:[NSURL URLWithString:mainDetail.cover]];
        [_personImage setImageWithURL:[NSURL URLWithString:mainDetail.author_face]];
        _bigLabel.text = mainDetail.author_nick;
        _smallLabel.text = mainDetail.cost_detail;
    }
}







@end
